package com.WOWTradeNews.DataBase;

import java.sql.DatabaseMetaData;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class DBHelper extends SQLiteOpenHelper{
	private static final int DB_VERSION = 1;
	private Context mContext;

	public DBHelper(Context context, String dbName) {
		//create database
		super(context, dbName, null, DB_VERSION);
		
		mContext = context;
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		/*table|tbl_trade_news|tbl_trade_news|2|CREATE TABLE "tbl_trade_news" 
		  ("_id" INTEGER PRIMARY KEY  NOT NULL ,"vchTitle" varchar(100) NOT NULL ,
		  "vchSummary" varchar(300) NOT NULL ,"vchContent" TEXT NOT NULL ,"intType" INTEGER,
		  "dtStartDate" DATETIME,"dtEndDate" DATETIME,"vchImageUrl" VARCHAR(300),"vchAttachmentUrl" VARCHAR(300),
		  "vchContent2" TEXT, "vchSource" VARCHAR, "intPublish" INTEGER NOT NULL  DEFAULT 1)*/

		//_id vchTitle vchSummary vchContent intType dtStartDate dtEndDate vchImageUrl vchAttachmentUrl 
		//vchContent2 vchSource intPublish
		
		String sql = "CREATE TABLE IF NOT EXISTS news"
				+ "(_id INTEGER PRIMARY KEY AUTOINCREMENT, iid TEXT, subject TEXT, contents TEXT, sid TEXT, datein TEXT,"
				+ "down_date TEXT, author TEXT, intPublish TEXT, country TEXT, city TEXT, news_link TEXT, " 
				+ "keywords TEXT, date_build TEXT, is_post INTEGER, img1 TEXT, txt1 TEXT, newsType INTEGER, imgData BLOB,acttime TEXT,active TEXT,img2 TEXT,img3 TEXT)";
		db.execSQL(sql);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// TODO Auto-generated method stub
		
	}
	
}
